package entity.capec;

import java.util.ArrayList;
import java.util.List;

/**
 * @author xym
 * @date 2020/7/15
 */
public class AttackPattern {
    private Integer id;
    private String name;
    private String description;
    /**
     * 该字段使用字符串表示，如"ChildOf:115"
     */
    private List<String> relatedAttackPattern;
    private String likelihoodOfAttack;
    private String typicalSeverity;
    private List<ExecutionFlow> executionFlow;
    private List<String> prerequisites;
    private List<String> skillsRequired;
    private List<String> resourcesRequired;
    private List<String> indicators;
    private List<String> consequences;
    private List<String> mitigations;
    private List<Integer> relatedWeakness;

    public AttackPattern() {
        this.relatedAttackPattern = new ArrayList<>();
        this.executionFlow = new ArrayList<>();
        this.prerequisites = new ArrayList<>();
        this.skillsRequired = new ArrayList<>();
        this.resourcesRequired = new ArrayList<>();
        this.indicators = new ArrayList<>();
        this.consequences = new ArrayList<>();
        this.mitigations = new ArrayList<>();
        this.relatedWeakness = new ArrayList<>();
    }

    public void addRelatedAttackPattern(String relatedAttackPattern) {
        this.relatedAttackPattern.add(relatedAttackPattern);
    }

    public void addExecutionFlow(ExecutionFlow executionFlow) {
        this.executionFlow.add(executionFlow);
    }

    public void addPrerequisites(String prerequisite) {
        this.prerequisites.add(prerequisite);
    }

    public void addSkillsRequired(String skillsRequired) {
        this.skillsRequired.add(skillsRequired);
    }

    public void addResourcesRequired(String resourcesRequired) {
        this.resourcesRequired.add(resourcesRequired);
    }

    public void addIndicator(String indicator) {
        this.indicators.add(indicator);
    }

    public void addConsequence(String consequence) {
        this.consequences.add(consequence);
    }

    public void addMitigation(String mitigation) {
        this.mitigations.add(mitigation);
    }

    public void addRelatedWeakness(Integer relatedWeakness) {
        this.relatedWeakness.add(relatedWeakness);
    }

    public Integer getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public String getDescription() {
        return description;
    }

    public List<String> getRelatedAttackPattern() {
        return relatedAttackPattern;
    }

    public String getLikelihoodOfAttack() {
        return likelihoodOfAttack;
    }

    public String getTypicalSeverity() {
        return typicalSeverity;
    }

    public List<ExecutionFlow> getExecutionFlow() {
        return executionFlow;
    }

    public List<String> getPrerequisites() {
        return prerequisites;
    }

    public List<String> getSkillsRequired() {
        return skillsRequired;
    }

    public List<String> getResourcesRequired() {
        return resourcesRequired;
    }

    public List<String> getIndicators() {
        return indicators;
    }

    public List<String> getConsequences() {
        return consequences;
    }

    public List<String> getMitigations() {
        return mitigations;
    }

    public List<Integer> getRelatedWeakness() {
        return relatedWeakness;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public void setLikelihoodOfAttack(String likelihoodOfAttack) {
        this.likelihoodOfAttack = likelihoodOfAttack;
    }

    public void setTypicalSeverity(String typicalSeverity) {
        this.typicalSeverity = typicalSeverity;
    }

    @Override
    public String toString() {
        return "AttackPattern{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", description='" + description + '\'' +
                ", relatedAttackPattern=" + relatedAttackPattern +
                ", likelihoodOfAttack='" + likelihoodOfAttack + '\'' +
                ", typicalSeverity='" + typicalSeverity + '\'' +
                ", executionFlow=" + executionFlow +
                ", prerequisites=" + prerequisites +
                ", skillsRequired=" + skillsRequired +
                ", resourcesRequired=" + resourcesRequired +
                ", indicators=" + indicators +
                ", consequences=" + consequences +
                ", mitigations=" + mitigations +
                ", relatedWeakness=" + relatedWeakness +
                '}';
    }
}
